package com.itheima.Demo1;

public class Poly {
    public static void main(String[] args) {
        Animal a = new Cat();
        a.eat();


        //向下转型
        Cat c =(Cat) a;
        c.look();
    }
}



class Animal{
    public void eat(){
        System.out.println("动物吃人");
    }
}


class Cat extends  Animal{
    @Override
    public void eat() {
        System.out.println("猫吃鱼");
    }

    public void look(){
        System.out.println("猫看家");
    }
}